package com.shunli.cterminal.controller;

import cn.hutool.extra.servlet.ServletUtil;
import com.examples.core.res.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName: NoAuthController
 * @Description: TODO
 * @Author: DAIYALU
 * @Date: 2024/7/1
 * @Version: 1.0
 */
@Tag(name = "管理后台 - 无权限访问")
@Slf4j
@RestController
@RequestMapping("/noAuth")
@RequiredArgsConstructor
public class NoAuthController {

    /**
     * 查询ip
     * @param httpServletRequest
     * @return
     */
    @Operation(summary = "查询ip")
    @GetMapping("/getIp")
    public CommonResult<String> getIp(HttpServletRequest httpServletRequest) {
        return CommonResult.data(ServletUtil.getClientIP(httpServletRequest));
    }
}
